﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace CIS.Client.Common.Popups
{
    public class MessageManager
    {
        private PopupMessageWindow mPopupMessageWindow = new PopupMessageWindow();
        /// <summary>
        /// Poup消息提示
        /// </summary>
        public PopupMessageWindow PopupMessageWindow { set { mPopupMessageWindow = value; } get { return mPopupMessageWindow; } }
        /// <summary>
        /// type: 0:常规 1:注意 2:警告
        /// </summary>
        /// <param name="element"></param>
        /// <param name="type"></param>
        public void ShowMessageTip(string info, ContentControl element = null, int type = 0, int delaytime = 3)
        {
            if (PopupMessageWindow != null && info.Length <= 30)
            {
                PopupMessageWindow.Element = element;
                PopupMessageWindow.InfoType = type;
                PopupMessageWindow.popupInfo.IsOpen = true;
                PopupMessageWindow.Info = info;
                PopupMessageWindow.Delay = delaytime;
                PopupMessageWindow.Show();
            }
        }
    }
}
